package org.ting.e_commerce.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.ting.e_commerce.mapper.UserMapper;
import org.ting.e_commerce.model.User;

@Service
public class UserService {
    @Autowired
    UserMapper userMapper;
    public boolean register(User user) {
        return userMapper.insertUser(user);
    }

    public User selectById(Integer userId) {
        return userMapper.selectById(userId);
    }
    public User selectByEmail(String email) {
        return userMapper.selectByEmail(email);
    }
    public User selectByPhone(String phone) {
        return userMapper.selectByPhone(phone);
    }
    public boolean updateUserById(User user){
        return userMapper.updateUserById(user);
    }
    public boolean updateUserByEmail(User user) {
        return userMapper.updateUserByEmail(user);
    }
}
